//
//  StewardTableViewCell.m
//  VTravel
//
//  Created by lanouhn on 16/8/2.
//  Copyright © 2016年 xiaoYu. All rights reserved.
//

#import "StewardTableViewCell.h"

@implementation StewardTableViewCell

- (void)setModel:(StewardListModel *)model{
    
    self.headerImageView.layer.cornerRadius = 30;
    self.headerImageView.layer.masksToBounds = YES;
    NSString *urlStr = [NSString stringWithFormat:@"/%@",model.avatar];
    [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:ImageURL(urlStr)]];
    self.nameLabel.text = model.name;
    NSString *caseLabelStr = [NSString stringWithFormat:@"已提供案例:  %@例   综合评分: %@", model.product_count, model.level_vir];
    self.caseLabel.text = caseLabelStr;
    
    
    NSMutableAttributedString *aAttributedString = [[NSMutableAttributedString alloc] initWithString:caseLabelStr];
    //富文本样式
    //文字颜色
    [aAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(8, 4)];
    //文字颜色
    // [aAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(22, 4)];
    
    self.caseLabel.attributedText = aAttributedString;

//    NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:self.caseLabel.text];
//    NSRange redRange = NSMakeRange([[noteStr string] rangeOfString:model.product_count].location, [[noteStr string] rangeOfString:model.product_count].length);
//    
//    NSRange redRange2 = NSMakeRange([[noteStr string] rangeOfString:model.level_vir].location, [[noteStr string] rangeOfString:model.level_vir].length);
//    
//    [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:redRange];
//    [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:redRange2];
//    
//    [self.caseLabel setAttributedText:noteStr];
//    [self.caseLabel sizeToFit];

    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
